/**
 * Copyright (c) 2010-2011 Pierre LABATUT
 *
 * This file is part of multiple-track-player project.
 *
 * multiple-track-player is free software: you can redistribute it and/or modify it
 * under the terms of its license which may be found in the accompanying
 * LICENSE file or <http://code.google.com/p/multiple-track-player/>.
 */
package multitrack.preload;

import java.util.Arrays;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;

/**
 * Main entry point to run the player as a standalone frame.
 * URL of a WAV, AIF or MP3 files are passed as argument.
 * 
 * @author Pierre LABATUT
 */
public class MainFrame {

    public static void main(final String[] args) {

        /**
         * Create the view, then initialize the PCM producers
         */
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                AudioPlayerView.setSystemLookAndFeel();
                final JFrame jFrame = new JFrame();
                jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

                final AudioPlayerView apv = new AudioPlayerView();
                jFrame.add(apv);
                jFrame.validate();
                jFrame.setVisible(true);

                AudioPlayer.initialize(apv, Arrays.asList(args));
            }
        });

    }
}
